import xadmin
from orders.models import Courier_Company, OrderInfo, OrderGoods, DiscountCoupon, ReturnDetail, ReturnDetailImage, \
    Business_Address, GoodsList, Reason, OrderInfoUpdate
from users.models import Address, Feedback


class DiscountCouponAdmin(object):
    list_display = ["name", "value", "start_time", "end_time", "issuance_counts", "used_counts",
                    "launch_counts", "category", "status", "user", "category_brand", "category_category", "full", ]


class GoodsListAdmin(object):
    list_display = ['discountcoupon_id', 'cate_goods', ]


class AddressAdmin(object):
    list_display = ["user", "receiver", "province", "city", "district", "mobile", ]


class Courier_CompanyAdmin(object):
    list_display = ["name", "price", ]


class OrderInfoAdmin(object):
    list_display = ["order_id", "freight", "create_time", "numbers", "address", "user", "courier_company","discountpackage","discount_value",
                    "total_count", "total_amount", "status", "discountcoupon", "business_address", "post_script",
                    'send_time', "pay_time", "success_time", ]
    list_filter = ["status","create_time" ]
    search_fields = ['status',"create_time"]


class OrderGoodsAdmin(object):
    list_display = ["id", "goods", "count", "price", "order", "comment", "score", "is_commented", "is_return", "update_time"]
    list_filter = ["is_return","update_time" ]
    search_fields = ['is_return',"update_time"]

class ReturnDetailAdmin(object):
    list_display = ["is_show","numbers","company", 'reason',"user","return_numbers","apply_time","check_time","check_results","check_reason","introduce","return_id","return_address_id","order_goods_id",]
    # list_display = ["is_show", "order_goods_id", ]


class Business_AddressAdmin(object):
    list_display = ['name', "phone_number", "person", 'province', 'city', 'district', 'place', ]


class ReturnDetailImageAdmin(object):
    list_display = ['image', 'return_detail', ]


class ReasonAdmin(object):
    list_display = ['id','return_type','explain', 'is_enabled', 'is_delete',]


class OrderInfoUpdateAdmin(object):
    list_display = ['id','new','orderinfo','create_time','check_user','old_receiver','update_receiver','old_address','update_address','old_mobile','update_mobile','old_total_amount','update_total_amount',]

class  FeedbackAdmin(object):
    list_display = ["user","suggestion_id","suggestion_text"]

xadmin.site.register(DiscountCoupon, DiscountCouponAdmin)
xadmin.site.register(GoodsList, GoodsListAdmin)
xadmin.site.register(Courier_Company, Courier_CompanyAdmin)
xadmin.site.register(OrderInfo, OrderInfoAdmin)
xadmin.site.register(OrderInfoUpdate, OrderInfoUpdateAdmin)
xadmin.site.register(OrderGoods, OrderGoodsAdmin)
xadmin.site.register(Address, AddressAdmin)
xadmin.site.register(ReturnDetail, ReturnDetailAdmin)
xadmin.site.register(ReturnDetailImage, ReturnDetailImageAdmin)
xadmin.site.register(Business_Address, Business_AddressAdmin)
xadmin.site.register(Reason, ReasonAdmin)
xadmin.site.register(Feedback, FeedbackAdmin)



